import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 清理缓存 */
export const deleteSettingCache = () => {
  return requestClient.delete<Result>(baseUrlApi('/admin/setting/cache'));
};

/** 获取网站信息 */
export const getSettingSite = () => {
  return requestClient.get<Result>(baseUrlApi('/admin/setting/site'));
};

/** 网站信息提交保存 */
export const putSettingSite = (data: object) => {
  return requestClient.put<Result>(baseUrlApi('/admin/setting/site'), data);
};

/** 获取后台设置 */
export const getSettingAdmin = () => {
  return requestClient.get<Result>(baseUrlApi('/admin/setting/admin'));
};

/** 后台设置提交保存 */
export const putSettingAdmin = (data?: object) => {
  return requestClient.put<Result>(baseUrlApi('/admin/setting/admin'), data);
};

/** 获取上传设置 */
export const getSettingUpload = () => {
  return requestClient.get<Result>(baseUrlApi('/admin/setting/upload'));
};

/** 上传设置提交保存 */
export const putSettingUpload = (data?: object) => {
  return requestClient.put<Result>(baseUrlApi('/admin/setting/upload'), data);
};

/** 获取文件存储设置 */
export const getSettingStorage = () => {
  return requestClient.get<Result>(baseUrlApi('/admin/setting/storage'));
};

/** 文件存储设置提交保存 */
export const putSettingStorage = (data?: object) => {
  return requestClient.put<Result>(baseUrlApi('/admin/setting/storage'), data);
};

/** 管理员修改密码 */
export const putSettingPassword = (data?: object) => {
  return requestClient.put<Result>(baseUrlApi('/admin/setting/password'), data);
};

/** 获取文件存储设置 */
export const getSettingLang = () => {
  return requestClient.get<Result>(baseUrlApi('/admin/setting/lang'));
};

/** 多语言设置提交保存 */
export const putSettingLang = (data?: object) => {
  return requestClient.put<Result>(baseUrlApi('/admin/setting/lang'), data);
};
